Add method body with cfg and locals#346
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR restructures the ETS method model by introducing a EtsMethodBody class that encapsulates both CFG (Control Flow Graph) and locals information, moving away from the direct cfg property on EtsMethod. The body contains locals extracted from IR, where missing locals indicate global variables rather than local ones.
- Introduces
EtsMethodBodyclass containing CFG and locals - Updates method building to populate locals from IR during conversion
- Maintains backward compatibility with deprecated
_cfgproperty
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Method.kt | Adds EtsMethodBody class and refactors EtsMethod interface to use body instead of direct CFG property |
| Convert.kt | Updates method builder to extract locals from DTO and populate method body with both CFG and locals |
| EtsCfgDslTest.kt | Updates test to use new method.body.cfg instead of deprecated method._cfg |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Contributor
CaelmBleidd
approved these changes
Aug 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds
val body: EtsMethodBodywith CFG and locals (taken from IR).Note that all "locals" (that could be found in IR) that do not present in this list of locals, are actually not locals, but probably global variables or other out of scope refs. For example
x := 42whenmethod.body.localslist does not containx, actually means "modify the global variablex", not local.